<?php

class UcCaselistController extends Controller
{
    /*
    * 获取列表
    *
    */
    public function actionGetList()
    {
        try {
            //参数验证

            //检测
            //$user_id = SessionService::getUserIDBySessionid();

            //参数列表
            $type_id = Util::getParamNotEmpty("type_id");


            //获取列表
            $searchsql = Util::initSearchSql();

            $searchsql = Util::getSerarchStr($searchsql, "type_id", "type_id"); //手机号

            //排序
            $searchsql = $searchsql . " order by create_time ";
            //获取list
            $list = UcCaselist ::model()->findAll($searchsql);


            $l = count($list);

            for($i=0;$i<$l;$i++)
            {
                $obj = $list[$i];

                $list2 = UcCasetask::model()->findAll("is_delete = 0 and case_id=".$obj->id);

                $obj->tasklist = $list2;
            }


	            //返回数据
	            Util::responseList(count($list), $list);


	        } catch (Exception $e) {
            Util::responseErrorMsg($e->getMessage());

        }
    }

    //获取详情
    /*
    * 修改
    *
    */
    public function actionGetDetail()
    {

        try {
            //检测
            $user_id = SessionService::getUserIDBySessionid();

            //参数验证
            $obj_id = Util::getParamNotEmpty("obj_id");



            //验证存在
            $obj = WorkerCaselist::model()->findByPK($obj_id);

            Util::checkExistAndNotDelete($obj);



            //返回数据
            Util::responseObj($obj);


        } catch (Exception $e) {
            Util::responseErrorMsg($e->getMessage());

        }
    }

}